package com.example.demo.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101200671813";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDPXK0LfbUsIQoM5CV7PH4JW0OcvetPZU+xCZKKRYoI+Lf1y60y5SwfOeKW+goX1oTd19nCaMDjR1+GUflyWBZ1Yvac8YIdimbrTGN00/Vh8V2pi68VOrA0X1e6QjP12NGwjgwpCMnqIKTRenNuRMf2R7wfFSA/5b6079c+FhA/mRZ3h8seSYLlINH137zx8zMtl3NQE9Emox10FSLnOh8Fq9vs4A1w1oEQMa0zD+IIPgmjr+M/Ve4Rf7t6o5NkWId0W27SEChdYwbDFTdSHlxPu6Ed4En8IFiBE2UCULsz11dI3YCcKcDcy4Ft6BrbKJebsa3pT5123I3MQGLlOoZ1AgMBAAECggEAa6gY61NbgUqx9hlo4D96zA7G3pS3m2Pk6OwoWYNa8+d1UrZo+HiE3L1nx6yPGusz1h1foBBUvGrszEa49EWJe25izP6R6BZX8qeZJyl4R15Rm1m7D5GFs9sgJ8KBSY1E6J4G8DLw6Y4DJAKn9ULech2yLI0CTkpQJY4zuLcpvmojejwXIM60av1sKjlGcAK5xAZXa80xi0duf2HoRT1Rs84UH0lNQFRfHLHH45sqlFSlg8qWf/iCget2yM9OwX4pPPZWswzCFuiQvlAKyBzKZMdH2j/Qcic1yHhBEmnGst23+AHME6rBeAwo2ClCPtPQUBSmKPmeUD5/zQKHlAAPYQKBgQD53BF8kPx/Ux3UyoLqck2nrbK/k0SnBsl+0bp4zqehnYG635S+MO4BZH/L0atztI5dYGEoUotfwL0cKCzfJa6efimWr8FAR+HRC1WgEpwoV2bFl6tFQhvmswCZhFuFv+sJYxqbIsRVBPZmrynYHhExH/YUpuHahGsOTrkjtI6CCQKBgQDUdT58BP/esrgcMWiR0E0p4Q5SIv5zFHWH+y+Ap0IXEtxHswjW7jd9FPwdNwZhjh1uswGbtEWTRT3MSlCL1eTxw4JvYjZuK2jKOZrKcmkuq0B0nbyduZdRlSXAQPxHyJ+ureIa1H8fLwtlyS2UucfL76VfDr3KdPgR3RQ/WBmMDQKBgQC2UUOdPnpQOgkBdYfTpPZPDSrqKX6l1gj/de/4KOsevbyk7HIv2apB7+BkjCjsM+rR7frXHmw+wXf8bMBZT7i8Q9j68GI2En2PORMQy6OQuD3wnnxF/Dg5vZIJcxAJZ4IMhnkqjFLwqr9VLCl/XmkzDFxWs3MILSmk9gKYMC7waQKBgCoo3e5kW5YIpwpJL7QHvtg5pcrc0NtrSutiCAoiprXHc1jzCSUFfpNer6zod2ayedq2wPHx8wCHc/zvHk6xck4beu25co2oJZJDnhjgXUj6iL7bcktmQcXZr/UXsDhacn2KWdzzIArDHiLjqhziROiONKXJWhYr4fJBibwMMn2dAoGBAIZ1DSH38BMOJ5aJiCR3Ml7yGphch29bLo9i2sIWAx5kkXkXBtDU5B5Q0ozBcdeIp7T1Px8XfJCN786XzRswUcT7E7RUfBYjZyOaFX/g7FSt1/Imx14rSyP/nRqhuGzVehq1xeJnCVdu8vpN6L8jsIxN2zJLasL/baZLqw++o0Jh";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnvjqDtCiXZlkcVLP08s69Di4leeTal8Q2auObU2kXthffpXNnwmVD/NOmMioNgGKnpK1afRV7JQtMDYjKuw9O1F20c7c0SYB/hTRoRJSGgCAX5kB1U+fw8Q9kyfn9I0wkdWOu4NujwcK7a20LZyoci/lKzF+a4uRI56jepzYdlLDJUEjKZPBjLY5sBI0dY11R2VxmYasT9hBy98qCf7XlamdXjDsUQrTYD6bqwTq/SI699wWHQakSRR2AcggHztqf2AcHjF2MCnVOfR6vI4Cj6B7wPSW6kcMHHjRDqNPGtN43h2yc6KgstW6Jz6CNVdo9qBogSPzHgwUSbfDHjB/wwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/success";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

